#ifndef ADDRESS_UI_LOGIC_H
#define ADDRESS_UI_LOGIC_H

#include <QButtonGroup>
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QObject>
#include <QPushButton>
#include <QRadioButton>
#include <QVBoxLayout>
#include "PptpClient.h"
#include "address_ui.h"
#include <qmessagebox.h>
class AddressLogic : public QObject
{
    Q_OBJECT
public:
    explicit AddressLogic(AddressUI *ui, QObject *parent = nullptr);
    ~AddressLogic();

private:
    AddressUI *ui; // Pointer to the UI
    int currentRow;
    void setupAddressData(); // Sets up sample address data
    PptpClient pptpclient;
    PptpMessage requestMessage;
    void getAddressBook();
    void onAddAddressClicked();
    void onEditAddressClicked(int row);
    void onDeleteAddressClicked(int row);
    void parseAddressAndCreateWidgets(int row, const QString &address);
    void parseAddressAndCreateWidgets(int row, const QString &address, int addressId);

private slots:
    void onAddResponseReceived(PptpMessage responseMessage);
    void onGetAddressBookResponse(PptpMessage responseMessage);
    void onEditAddressResponse(PptpMessage responseMessage);
    void onDeleteAddressResponse(PptpMessage responseMessage);

};

#endif // ADDRESS_UI_LOGIC_H
